package com.zx.znav.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.zx.znav.bean.UserDescription;
import com.zx.znav.service.UserDescriptionService;
import com.zx.znav.mapper.UserDescriptionMapper;
import org.springframework.stereotype.Service;

/**
* @author lenovo
* @description 针对表【t_user_description】的数据库操作Service实现
* @createDate 2023-08-16 15:12:40
*/
@Service
public class UserDescriptionServiceImpl extends ServiceImpl<UserDescriptionMapper, UserDescription>
    implements UserDescriptionService{

    @Override
    public UserDescription getDescriptionByUserId(Integer userId) {
        LambdaQueryWrapper<UserDescription> wrapper = new LambdaQueryWrapper<>();
        wrapper.eq(UserDescription::getUserId, userId);
        return getOne(wrapper);
    }

    @Override
    public Boolean updateByUserId(Integer userId, String content) {
        LambdaUpdateWrapper<UserDescription> wrapper = new LambdaUpdateWrapper<>();
        wrapper.eq(UserDescription::getUserId, userId);
        wrapper.set(UserDescription::getContent, content);
        return update(wrapper);
    }
}




